<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JavaScript能够改变HTML属性</title>
</head>
<body>
    <h2>JavaScript 能做什么？</h2>
    <p>JavaScript 能够改变 HTML 属性值。</p>
    <p>在本例中，JavaScript 改变了图像的 src 属性值。</p>
    <button onclick="document.getElementById('myImage').src='/i/eg_bulboff.gif'">开灯</button>
    <img id="myImage" border="0" src="/i/eg_bulboff.gif" style="text-align:center;">    
    <button onclick="document.getElementById('myImage').src='/i/eg_bulboff.gif'">关灯</button>
</body>
</html>